package com.thread;

/**
 * Created by Administrator on 2018/5/29.
 */
public class TestThread3 {

    public static void main(String[] args) {
        System.out.println("进入线程：" + Thread.currentThread().getName());
        TestThread3 testThread3 = new TestThread3();
        Thread3 thread3 = testThread3.new Thread3();
        thread3.start();
        System.out.println("线程" + Thread.currentThread().getName() + "等待");
        try {
            thread3.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("线程" + Thread.currentThread().getName() + "继续执行");

    }


    class Thread3 extends Thread{

        @Override
        public void run() {
            System.out.println("进入线程：" + Thread.currentThread().getName());
            try {
                Thread.currentThread().sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("线程" + Thread.currentThread().getName() + "执行完毕");

        }
    }

}
